#! /usr/bin/python

import mathex
import sys

def main():
    con = 0      # for consecutive
    first = 0
    for n in range(1,1000000):
        if n%1000 == 0:
            print n
            sys.stdout.flush()
        if len(mathex.primeFactorOf(n)) == 4:
            con = con + 1
            if con == 1:
                first = n
            elif con == 4:
                print first
                break
        else:
            con = 0

if __name__ == '__main__':
    main()
    
